<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title></title>
		<meta charset="utf-8">
		<#include "common/reference.ftl"/>
		<#include "common/ligerui.ftl"/>
		<script type="text/javascript">
		<!--
			
			var ligerTable = null;
			$(function(){
				ligerTable = $('#table').ligerGrid({
					width:'98%',
					enabledSort:false,
					pageSizeOptions:[5,10,20,50,100,200],
					height:'auto',
					alternatingRow:true,
					url:'${base}/${route}/getList',
					pageSize:20,
					columns:[
						{display:'申请用户',name:'applyUser',id:'applyUser',align:'center'},
						{display:'申请金额(元)',name:'applyCash',id:'applyCash',align:'center'},
						{
                            display:'用户类型',
                            name:'applyUserType',
                            id:'applyUserType',
                            align:'center',
                            render:function(row){
                                var userType = row.applyUserType;
                                if(userType == 1){
                                    return '用户';
                                }
                                else if(userType == 2){
                                    return '司机';
                                }else if(userType == 16){
                                    return '票务经理';
                                }
                                return '-';
                            }
                        },
						{
							display:'申请时间',
							name:'applyTime',
							id:'applyTime',
							align:'center',
							render:function(row){
								var applyTime = row.applyTime * 1000;
								return formatDate(applyTime);
							}
						},
						{
                            display:'审核状态',
                            name:'status',
                            id:'status',
                            align:'center',
                            minWidth:150,
                            render:function(row){
                                var status = row.status;
                                if(status == 1){
                                    return '<span style="color:#ccc">待审核</span>';
                                }
                                else if(status == 2){
                                    return '<span style="color:#0f0">审核通过</span>';
                                }
                                else if(status == 4){
                                    return '<span style="color:#f00">审核不通过</span>';
                                }
                                return '-';
                            }
                        },
						{
							display:'操 作',
							align:'center',
							render:function(row){
								//申请和审核中
								if(row.status < 2){
									var applyId = row.applyId;
									return [ 
											'<a class="edit" href="javascript:void(0)" onclick="audit('+applyId+')"  title="审核">',
								                '<i class="fa fa-check-square-o"></i>',
								                '审核',
								            '</a>'
								            ].join('');
								}
								else{
									return '-';
								}
							}
						}
					]
				});
		        
				
				$('#btnSearch').click(function(){
					if(ligerTable){
						var startTime = $('#txtStartTime').val();
						var endTime = $('#txtEndTime').val();
						var searchKey = $('#txtSearchKey').val();
						ligerTable.setParm('startTime',startTime);
						ligerTable.setParm('endTime',endTime);
						ligerTable.setParm('searchKey',searchKey);
						ligerTable.reload();
					}
				});
				$('.date-picker').datepicker({autoclose:true});
			});
			
			function audit(applyId){
				var url='${base}/${route}/audit/'+applyId;
	            changePage(url);
			}
		-->
		</script>		
	</head>
	<body>
		<#include "common/breadcrumb.ftl">
		<div class="widget-box">
			<div class="widget-header">
				<h5 class="lighter">查询</h5>
			</div>
			<div class="widget-body">
				<div class="widget-main">
					<div class="row">
						<div class="col-sm-1">
							<label>开始时间</label>
						</div>
						<div class="col-sm-3">
							<div class="input-group">
								<input class="form-control date-picker" id="txtStartTime" type="text" value="${startTime}" data-date-format="yyyy-mm-dd" />
								<span class="input-group-addon">
									<i class="fa fa-calendar"></i>
								</span>
							</div>
						</div>
						<div class="col-sm-1">
							<label>截至时间</label>
						</div>
						<div class="col-sm-3">
							<div class="input-group">
								<input class="form-control date-picker" id="txtEndTime" type="text" value="${endTime}" data-date-format="yyyy-mm-dd" />
								<span class="input-group-addon">
									<i class="fa fa-calendar"></i>
								</span>
							</div>
						</div>
					</div>
					<div class="space-4"></div>
					<div class="row">
						<div class="col-sm-8">
							<div class="input-group">
								<span class="input-group-addon">关键字</span>
								<input id="txtSearchKey" type="text" class="form-control search-query" placeholder="请输关键字" />
								<span class="input-group-btn">
									<button id="btnSearch" type="button" class="btn btn-purple btn-sm">
										查询
										<i class="icon-search icon-on-right bigger-110"></i>
									</button>
								</span>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="widget-box">
			<div class="widget-header">
				<h5 class="lighter">
					<i class="icon-table"></i>
					${module}列表
				</h5>
			</div>
			<div class="widget-body">
				<div id="table"><div>
			</div>
		</div>
	</body>
</html>